﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DTO;
namespace DAO
{
    public class TS_CT_TP_DAO
    {
        public DataProvider _provider = new DataProvider();
        public TS_CT_TP_DAO()
        {
            _provider.connect();
        }
        public void proc_Ins_SoLuongNLChoMoiTP(TS_CT_TP_DTO dto)
        {
            _provider.proc_Ins_SoLuongNLChoMoiTP(dto);
        }
        
        public DataTable GetNLCuaTP(int MaTP)
        {
            string s = "select TS_CT_TP.MaNLG, NLG.TenNLG,TS_CT_TP.SoLuong "
                      + " from TS_CT_TP, NLG"
                      + " where TS_CT_TP.MaNLG = NLG.MaNLG and MaTP = " + MaTP;
            return _provider.executeQuery(s);
        }
        public void Up_SoLuongNLCuaTP(TS_CT_TP_DTO dto)
        {
            string s = "update TS_CT_TP set SoLuong = " + dto.SoLuong
                       + " where MaTP = " + dto.MaTP + " and MaNLG = " + dto.MaNLG;
            _provider.executeNonQuey(s);

        }
        public void Del_SoLuongNLCuaTP(TS_CT_TP_DTO dto)
        {
            string s = " delete from TS_CT_TP"
                       + " where MaTP = " + dto.MaTP + " and MaNLG = " + dto.MaNLG;
            _provider.executeNonQuey(s);

        }
    }
}
